package practice04;

/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: practice04
 * @ClassName: News
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/12/11 19:54
 * @Copyright 大牛版板所有
 */
public class News implements IComparable {
    private int number;
    private String title;
    private String content;
    private int clickNum;

    public News() {
    }

    public News(int number, String title, String content, int clickNum) {
        this.number = number;
        this.title = title;
        this.content = content;
        this.clickNum = clickNum;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getClickNum() {
        return clickNum;
    }

    public void setClickNum(int clickNum) {
        this.clickNum = clickNum;
    }

    @Override
    public int compareTo(Object object){
        News news = (News) object;
        if (this.number == news.getNumber()){
            return 0;
        }
        else if (this.number > news.getNumber()){
            return 1;
        }
        return -1;
    }
}
